// Loesung_von_Aufgabe_2.1.4_6_Formel

float s; // Ort in m
float x; // Ort in cm
int y = 170;
float t;

void setup()
{
  size(850, 200);
  frameRate(1000); // möglichst hohe Bildwiederholungsrate einstellen
}

void draw()
{
  background(255);
  translate(300, 0);

  // Mittellinie
  strokeWeight(3);
  line(0, 0, 0, 200);

  t = t + 1/frameRate;
  s = -0.5*t*t*t + 3*t*t - 3*t; // Ort in Meter
  x = 100 * s; // Ort in Zentimeter

  fill(0, 0, 255);
  rect(x, y, 60, 30);

  textSize(24);
  text("x in cm = " +x, 100, 50);

  if (t >= 5.0)
  {
    noLoop();
  }
  println("x in cm = " +x, "t in s = " +t);
}